<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>图书管理</title>
    <%@ include file="/common/head.jsp" %>
    <script type="text/javascript">
        $(function () {
            $("a.delete").click(function () {
                return confirm("确认是否删除" + $(this).parent().parent().find("td:first").text() + "？");
            });
        });
    </script>
</head>
<body>

<div id="header">
    <%@include file="/common/logo.jsp" %>
    <span class="wel_word">图书管理系统</span>
    <%@include file="/common/manager_head.jsp" %>
</div>

<div id="main">
    <table>
        <tr>
            <td>名称</td>
            <td>价格</td>
            <td>作者</td>
            <td>销量</td>
            <td>库存</td>
            <td colspan="2">操作</td>
        </tr>

        <c:forEach items="${requestScope.books}" var="item">
            <tr>
                <td>${item.name}</td>
                <td>${item.price}</td>
                <td>${item.author}</td>
                <td>${item.sales}</td>
                <td>${item.inventory}</td>
                <td><a href="http://localhost:8080/bookstore/managerServlet?action=display&id=${item.id}">修改</a></td>
                <td><a class="delete" href="http://localhost:8080/bookstore/managerServlet?action=delete&id=${item.id}">删除</a>
                </td>
            </tr>
        </c:forEach>

        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td><a href="pages/manager/book_edit.jsp?action=add">添加图书</a></td>
        </tr>
    </table>
</div>

<%@include file="/common/footer.jsp" %>
</body>
</html>